<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      document.onkeydown = function (e) {
        var key = e.key;
        switch (key) {
          case "a":
            if (e.altKey) {
              console.log("按了alt + a键");
              break;
            }
          case "b":
            if (e.ctrlKey) {
              console.log("按了b+ctrl按键");
              break;
            }
          case "C":
            if (e.shiftKey) {
              console.log("按了c+shift按键");
            }
          default:
            console.log("按了除了a和b的按键");
            break;
        }
      };
    </script>
  </body>
</html>
